#include "stdafx.h"
#include "Haffman.h"

Haffman::Haffman(){

}

Haffman::~Haffman(){

}

ifstream* Haffman::build(string filename){
	ifstream file;
	file.open(filename.c_str());
	if (!file)
	{
		return 0;
	} 
	else
	{
		this->readFileForDoSomething(&file);
		return this->outFile;
	}
}


void Haffman::buildItems(char bytes[]){
	//haffmanItemList.push_back(new HaffmanItem);
	cout<<bytes;
}

void Haffman::writeOutFile(char data[]){
	if(!this->outFile){
		
	}
}

void Haffman::readFileForDoSomething(ifstream* file){
	char temp[2];
	int te = 0;
	while(file->get(temp[0])){
		if((temp[0] & 0x10000000) == 0x10000000){
			if( !(file->get(temp[1]))){
				temp[1] = 0;
			}
		}
		this->buildItems(temp);
		temp[1] = 0;
	}
	cout<<te;
}